package com.guigu.equipmentservice.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.common.utils.R;
import com.guigu.equipmentservice.entity.EquipmentImage;
import com.guigu.equipmentservice.entity.EquipmentVideo;
import com.guigu.equipmentservice.service.EquipmentVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import com.guigu.common.utils.R;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 设备视频表（存储设备的展示视频，可选上传） 前端控制器
 * </p>
 *
 * @author zcy
 * @since 2025-09-28
 */
@RestController
@RequestMapping("/equipmentservice/equipmentVideo")
public class EquipmentVideoController {
    @Autowired
    private EquipmentVideoService equipmentVideoService;
    /**
     * 前台-根据当前设备id去查询当前设备视频对象
     * */
    @GetMapping("/selectEquipmentVideoByEqId/{id}")
    public R selectEquipmentVideoByEqId(@PathVariable("id") Integer id) {

        //查询设备视频
        QueryWrapper<EquipmentVideo> equipmentVideoQueryWrapper = new QueryWrapper<>();
        equipmentVideoQueryWrapper.eq("equipment_id", id);

        EquipmentVideo equipmentVideo = equipmentVideoService.getOne(equipmentVideoQueryWrapper);

        return R.ok().data("equipmentVideo",equipmentVideo);
    }
}
